Make sure that opt_nosmp also disables hyperthreading. This stops us
authorsos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Wed, 27 Jul 2005 10:52:29 +0000 (10:52 +0000)
committersos22@douglas.cl.cam.ac.uk <sos22@douglas.cl.cam.ac.uk>
Wed, 27 Jul 2005 10:52:29 +0000 (10:52 +0000)
from trying to create domains on non-existent threads, which would
lead to a rather nasty crash.

Signed-off-by: Steven Smith, sos22@cam.ac.uk
xen/arch/x86/cpu/common.c
xen/arch/x86/setup.c
xen/common/domain.c
xen/common/sched_sedf.c

index 49661af7d84fff8670d223da22352524e3dee0d5..13628447aa35d4d813f1712915663377ea54c75d 100644 (file)
@@ -427,12 +427,17 @@ void __init detect_ht(struct cpuinfo_x86 *c)
        u32     eax, ebx, ecx, edx;
        int     index_msb, tmp;
        int     cpu = smp_processor_id();
+       extern int opt_nosmp;
 
        if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
                return;
 
-       cpuid(1, &eax, &ebx, &ecx, &edx);
-       smp_num_siblings = (ebx & 0xff0000) >> 16;
+       if (opt_nosmp) {
+               smp_num_siblings = 1;
+       } else {
+               cpuid(1, &eax, &ebx, &ecx, &edx);
+               smp_num_siblings = (ebx & 0xff0000) >> 16;
+       }
 
        if (smp_num_siblings == 1) {
                printk(KERN_INFO  "CPU: Hyper-Threading is disabled\n");
index 1ca0ed71543d32ba4e7428cff13f72553425ecb9..ed010f88dca89322aa5772d53626e846db708ba3 100644 (file)
@@ -35,7 +35,7 @@ integer_param("xenheap_megabytes", opt_xenheap_megabytes);
 #endif
 
 /* opt_nosmp: If true, secondary processors are ignored. */
-static int opt_nosmp = 0;
+int opt_nosmp = 0;
 boolean_param("nosmp", opt_nosmp);
 
 /* maxcpus: maximum number of CPUs to activate. */
index 1b42a17dca6d897c8c91d46e47a0a15ac7c159d9..94fa6f9f8be962f188182e15363ce3e57b001784 100644 (file)
@@ -31,6 +31,7 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
     struct domain *d, **pd;
     struct vcpu *v;
 
+    ASSERT(cpu_online(cpu));
     if ( (d = alloc_domain_struct()) == NULL )
         return NULL;
 
@@ -41,7 +42,7 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu)
 
     d->domain_id   = dom_id;
     v->processor  = cpu;
+
     spin_lock_init(&d->big_lock);
 
     spin_lock_init(&d->page_alloc_lock);
index 1b7ac0cbf4884500a7b643bf976dbe499660d8a3..5a9d69b668696326cf6129020c37491a58ae0193 100644 (file)
@@ -1225,6 +1225,9 @@ void sedf_wake(struct vcpu *d) {
     /*check whether the awakened task needs to invoke the do_schedule
       routine. Try to avoid unnecessary runs but:
       Save approximation: Always switch to scheduler!*/
+    ASSERT(d->processor >= 0);
+    ASSERT(d->processor < NR_CPUS);
+    ASSERT(schedule_data[d->processor].curr);
     if (should_switch(schedule_data[d->processor].curr, d, now))
         cpu_raise_softirq(d->processor, SCHEDULE_SOFTIRQ);
 }